export default class LayerManager {
    constructor(viewer) {
        this.viewer = viewer;
        this.pointPrimitive = viewer.scene.primitives.add(new Cesium.PointPrimitiveCollection());
        this.polymericDataSource = null;
        this.billboards = viewer.scene.primitives.add(new Cesium.BillboardCollection({
            scene: viewer.scene
        }));
        this.currentGeoJson = null;
        this.init();
        this.Tile = null;
        this.vecTile = null;
    }
    init() {
        this.viewer.scene.globe.showGroundAtmosphere = false; //关闭地面大气圈
        this.viewer.scene.skyAtmosphere.show = false; //关闭天空大气圈
    }
    remove3dTiles(){
        if(this.Tile !== null){
            viewer.scene.primitives.remove(this.Tile)
            this.Tile = null;
        }
        if(this.vecTile !== null){
            viewer.scene.primitives.remove(this.vecTile)
            this.vecTile = null;
        }
        // viewer.scene.primitives.removeAll()
    }
    add3dTiles(url){
        let tilesetModel = new Cesium.Cesium3DTileset({
            url
        });
        tilesetModel.readyPromise.then(function (argument) {
            viewer.scene.primitives.add(tilesetModel);
            viewer.zoomTo(tilesetModel);
        }).otherwise(function (error) {
            
        });
        return tilesetModel;
    }
    
}